{"cells":[{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":29305,"status":"ok","timestamp":1746147986181,"user":{"displayName":"Jaylen Shawcross","userId":"09969990004531500002"},"user_tz":420},"id":"b8Bae67OMfEi","outputId":"c44f5859-0160-404d-c505-3efc04ab612a"},"outputs":[{"output_type":"stream","name":"stdout","text":["Mounted at /content/drive\n","Mounted at /content/drive\n"]}],"source":["#grab filepath\n","from google.colab import drive\n","drive.mount('/content/drive')\n","drive.mount(\"/content/drive\", force_remount=True)\n","directory = '/content/drive/My Drive/'\n","#fname = 'gasNeitherEdMax.out-100'\n","#fname = 'gasCationsMax2.out-100'\n","#fname = 'gasNeitherEdFlare.out-100'\n","#fname = 'gasCationsEdFlare.out-100'\n","#fnames = ['gasNeitherEdMax.out-100','gasCationsMax2.out-100','gasNeitherEdFlare.out-100','gasCationsEdFlare.out-100']\n","fname = 'gasNeitherEdMin.out-100'\n","import sys,matplotlib\n","from matplotlib import colors, ticker, cm\n","from IPython.display import HTML\n","src = 'https://www.youtube.com/embed'\n","#sys.path.append('../../utils/')\n","src+='/CJFHFJl_lMQ?autoplay=1&start=123'\n","atb = 'frameborder=\"0\" allow=\"autoplay\"'\n","matplotlib.use('Agg')\n","from numpy import *\n","from pylab import *\n","import getopt\n","import os, re\n","import pdb\n","import pandas as pd\n","import math as math\n","import linecache\n","from matplotlib.colors import LogNorm\n","from scipy import interpolate\n","import pickle as pickle\n","%matplotlib inline"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":1000},"executionInfo":{"elapsed":4315,"status":"ok","timestamp":1746147990498,"user":{"displayName":"Jaylen Shawcross","userId":"09969990004531500002"},"user_tz":420},"id":"0GBhFmjkQRH_","outputId":"89dec4bb-b725-4d25-a76b-0fc3603de063"},"outputs":[{"output_type":"stream","name":"stdout","text":["89\n","/content/drive/My Drive/gasNeitherEdMin.out-100\n","['22)CH4=1CH2+H2k=0.00E+00', '24)CH4=CH2+2Hk=0.00E+00', '25)CH4=CH3+Hk=0.00E+00', '26)CH4=CH+H+H2k=0.00E+00', '32)C2H4=C2H2+2Hk=0.00E+00', '89)C4H2=C4H+Hk=0.00E+00', '142)C6H2=C6H+Hk=0.00E+00', '146)C6H4=C6H2+H2k=0.00E+00', '147)C6H4=C4H2+C2H2k=0.00E+00', '148)C6H4=C6H3+Hk=0.00E+00', '187)HC3N=C3N+Hk=0.00E+00', '198)CH3CN=CN+CH3k=0.00E+00', '205)C2H3CN=HCN+C2H2k=0.00E+00', '207)C2H3CN=HC3N+H2k=0.00E+00', '259)CH2NH=HCN+H2k=0.00E+00', '271)H+CH2=CH+H2k=2.66E-10T**0.00EXP(0.0/T)(10.<T<400.),k=-1.00E+00T**0.00EXP(0.0/T)(400.<T<2000.)', '274)H+CH4=CH3+H2k=1.02E-18T**2.50EXP(-4825.0/T)(10.<T<400.),k=2.20E-20T**3.00EXP(-4041.0/T)(0.<T<0.)', '278)H+C2H3=C2H2+H2k=1.50E-12T**0.50', '316)H+C6H3=C6H2+H2k=3.00E-12T**0.50', '319)H+C6H4=C6H3+H2k=1.10E-17T**2.53EXP(-4648.0/T)', '400)N+CH3=H2CN+Hk=7.40E-11T**0.26EXP(-8.4/T)(10.<T<400.),k=1.01E-08T**-0.31EXP(-145.0/T)(400.<T<3000.)', '441)N+CHCN=HCN+CNk=1.40E-11T**0.17', '464)N(2D)+C2H6=NH+C2H5k=1.90E-11', '479)N(2D)+C2H3CN=N2+C3H3k=4.00E-11', '482)N(2D)+CH3CN=N2+C2H3k=5.00E-11', '484)N(2D)+HCN=CH+N2k=5.00E-11', '497)N(2D)+C2H6=CH2NH+CH3k=1.90E-11', '520)NH+C2H2=CHCN+H2k=2.00E-09T**-1.07', '521)NH+C2H4=CH3CN+H2k=1.15E-09T**-1.09', '554)NH+C2H4=NH2+C2H3k=1.16E-09T**-1.09', '655)CH+CH4=C2H4+Hk=3.96E-08T**-1.04EXP(-36.0/T)(10.<T<295.),k=1.58E-08T**-0.90EXP(0.0/T)(295.<T<3000.)', '657)CH+C2H4=C2H2+CH3k=2.23E-10EXP(173.0/T)', '777)2CH3+M=C2H6+Mk0=0.00E+00EXP(0.0/T)', '856)C2H+C2H2=C4H2+Hk=1.30E-10', '865)C2H+CH3C2H=C4H2+CH3k=1.60E-10EXP(71.0/T)', '874)C2H+C4H2=C6H2+Hk=1.06E-10T**-0.25', '883)C2H+C6H2=C8H2+Hk=1.06E-10T**-0.20', '943)C2H4+C4H=C6H2+H2+Hk=1.96E-10T**-0.40EXP(9.0/T)', '943)C2H4+C4H=C6H2+H2+Hk=1.96E-10T**-0.40EXP(9.0/T)', '1038)C6H+C2H2=C8H2+Hk=1.10E-10EXP(28.0/T)', '1040)C6H+C2H6=C6H2+C2H5k=3.50E-11EXP(3.0/T)', '1051)CN+C2H4=C2H3CN+Hk=2.70E-11EXP(172.0/T)', '1053)CN+CH3C2H=CH3C2CN+Hk=2.05E-10', '1062)CN+C2H2=HC3N+Hk=2.72E-10T**-0.52EXP(-19.0/T)', '1065)CN+C4H2=HC5N+Hk=2.72E-10T**-0.52EXP(-19.0/T)', '1065)CN+C4H2=HC5N+Hk=2.72E-10T**-0.52EXP(-19.0/T)', '1068)CN+CH2NH=HCN+H2CNk=6.71E-11EXP(-412.0/T)', '1070)CN+HC5N=C6N2+Hk=2.70E-10T**-0.52EXP(19.0/T)', '1070)CN+HC5N=C6N2+Hk=2.70E-10T**-0.52EXP(19.0/T)', '1071)CN+C2H2=C2H+HCNk=2.20E-10', '1101)H2CN+H=HCN+H2k=6.00E-11', '1142)C3N+C2H2=HC5N+Hk=8.60E-15T**1.80EXP(474.0/T)', '1155)CH3C2CN+CN=C4N2+CH3k=1.79E-11T**-0.67', '1156)CH3C2CN+C2H=HC5N+CH3k=4.00E-11T**-1.00', '1182)CH2NH+1CH2=H2CN+CH3k=3.00E-10', '1183)CH2NH+CH=CH3CN+Hk=2.00E-10']\n","-------------------------\n","56\n","                Reaction                               Rate Constant\n","0            CH4=1CH2+H2                                    0.00E+00\n","1             CH4=CH2+2H                                    0.00E+00\n","2              CH4=CH3+H                                    0.00E+00\n","3            CH4=CH+H+H2                                    0.00E+00\n","4           C2H4=C2H2+2H                                    0.00E+00\n","5             C4H2=C4H+H                                    0.00E+00\n","6             C6H2=C6H+H                                    0.00E+00\n","7           C6H4=C6H2+H2                                    0.00E+00\n","8         C6H4=C4H2+C2H2                                    0.00E+00\n","9            C6H4=C6H3+H                                    0.00E+00\n","10            HC3N=C3N+H                                    0.00E+00\n","11          CH3CN=CN+CH3                                    0.00E+00\n","12       C2H3CN=HCN+C2H2                                    0.00E+00\n","13        C2H3CN=HC3N+H2                                    0.00E+00\n","14          CH2NH=HCN+H2                                    0.00E+00\n","15           H+CH2=CH+H2      2.66E-10T**0.00EXP(0.0/T)(10.<T<400.),\n","16          H+CH4=CH3+H2  1.02E-18T**2.50EXP(-4825.0/T)(10.<T<400.),\n","17        H+C2H3=C2H2+H2                             1.50E-12T**0.50\n","18        H+C6H3=C6H2+H2                             3.00E-12T**0.50\n","19        H+C6H4=C6H3+H2               1.10E-17T**2.53EXP(-4648.0/T)\n","20          N+CH3=H2CN+H     7.40E-11T**0.26EXP(-8.4/T)(10.<T<400.),\n","21         N+CHCN=HCN+CN                             1.40E-11T**0.17\n","22    N(2D)+C2H6=NH+C2H5                                    1.90E-11\n","23  N(2D)+C2H3CN=N2+C3H3                                    4.00E-11\n","24   N(2D)+CH3CN=N2+C2H3                                    5.00E-11\n","25       N(2D)+HCN=CH+N2                                    5.00E-11\n","26  N(2D)+C2H6=CH2NH+CH3                                    1.90E-11\n","27       NH+C2H2=CHCN+H2                            2.00E-09T**-1.07\n","28      NH+C2H4=CH3CN+H2                            1.15E-09T**-1.09\n","29      NH+C2H4=NH2+C2H3                            1.16E-09T**-1.09\n","30         CH+CH4=C2H4+H   3.96E-08T**-1.04EXP(-36.0/T)(10.<T<295.),\n","31      CH+C2H4=C2H2+CH3                        2.23E-10EXP(173.0/T)\n","32         2CH3+M=C2H6+M                          0.00E+00EXP(0.0/T)\n","33       C2H+C2H2=C4H2+H                                    1.30E-10\n","34   C2H+CH3C2H=C4H2+CH3                         1.60E-10EXP(71.0/T)\n","35       C2H+C4H2=C6H2+H                            1.06E-10T**-0.25\n","36       C2H+C6H2=C8H2+H                            1.06E-10T**-0.20\n","37    C2H4+C4H=C6H2+H2+H                  1.96E-10T**-0.40EXP(9.0/T)\n","38    C2H4+C4H=C6H2+H2+H                  1.96E-10T**-0.40EXP(9.0/T)\n","39       C6H+C2H2=C8H2+H                         1.10E-10EXP(28.0/T)\n","40    C6H+C2H6=C6H2+C2H5                          3.50E-11EXP(3.0/T)\n","41      CN+C2H4=C2H3CN+H                        2.70E-11EXP(172.0/T)\n","42   CN+CH3C2H=CH3C2CN+H                                    2.05E-10\n","43        CN+C2H2=HC3N+H                2.72E-10T**-0.52EXP(-19.0/T)\n","44        CN+C4H2=HC5N+H                2.72E-10T**-0.52EXP(-19.0/T)\n","45        CN+C4H2=HC5N+H                2.72E-10T**-0.52EXP(-19.0/T)\n","46     CN+CH2NH=HCN+H2CN                       6.71E-11EXP(-412.0/T)\n","47        CN+HC5N=C6N2+H                 2.70E-10T**-0.52EXP(19.0/T)\n","48        CN+HC5N=C6N2+H                 2.70E-10T**-0.52EXP(19.0/T)\n","49       CN+C2H2=C2H+HCN                                    2.20E-10\n","50         H2CN+H=HCN+H2                                    6.00E-11\n","51       C3N+C2H2=HC5N+H                 8.60E-15T**1.80EXP(474.0/T)\n","52   CH3C2CN+CN=C4N2+CH3                            1.79E-11T**-0.67\n","53  CH3C2CN+C2H=HC5N+CH3                            4.00E-11T**-1.00\n","54   CH2NH+1CH2=H2CN+CH3                                    3.00E-10\n","55      CH2NH+CH=CH3CN+H                                    2.00E-10\n"]},{"output_type":"stream","name":"stderr","text":["/usr/local/lib/python3.11/dist-packages/IPython/core/display.py:724: UserWarning: Consider using IPython.display.IFrame instead\n","  warnings.warn(\"Consider using IPython.display.IFrame instead\")\n"]},{"output_type":"execute_result","data":{"text/plain":["<IPython.core.display.HTML object>"],"text/html":["<iframe src=\"https://www.youtube.com/embed/CJFHFJl_lMQ?autoplay=1&start=123\"frameborder=\"0\" allow=\"autoplay\"width=\"8\" height=\"3\" ></iframe>"]},"metadata":{},"execution_count":2}],"source":["# load data\n","reactions = [\n","    'CH4=1CH2+H',\n","    'CH4=CH3+H',\n","    'CH4=CH2+2H',\n","    'H+CH2=CH+H2',\n","    'N(2D)+HCN=CH+N2',\n","    'CH4=CH+H+H2',\n","    'CH+CH4=C2H4+H',\n","    'CH+C2H4=C2H2+CH3',\n","    'CN+C2H2=C2H+HCN',\n","    'C2H4=C2H2+2H',\n","    'CN+C2H4=C2H3CN+H',\n","    'H+C2H3=C2H2+H2',\n","    'CN+C2H2=HC3N+H',\n","    'NH+C2H2=CHCN+H2',\n","    'N+CHCN=HCN+CN',\n","    'NH+C2H4=NH2+C2H3',\n","    'NH+C2H4=CH3CN+H2',\n","    'HC3N=C3N+H',\n","    'N(2D)+HC3N=N2+C3H',\n","    'C3N+C2H2=HC5N+H',\n","    'CN+HC5N=C6N2+H' ,\n","    'C2H3CN=HCN+C2H2',\n","    'N(2D)+C2H3CN=N2+C3H3',\n","    'C2H3CN=HC3N+H2',\n","    'N(2D)+CH3CN=N2+C2H3',\n","    'CH3CN=CN+CH3',\n","    'N+CH3=H2CN+H',\n","    'H2CN+H=HCN+H2',\n","    '2CH3+M=C2H6+M',\n","    'N(2D)+C2H6=NH+C2H5',\n","    'N(2D)+C2H6=CH2NH+CH3',\n","    '(CH+C2H6=C3H6+H)',\n","    '(C2H+C2H6=C2H2+C2H5)',\n","    'CH2NH=HCN+H2',\n","    'CH2NH+1CH2=H2CN+CH3',\n","    'CH2NH+CH=CH3CN+H' ,\n","    'C2H4+C4H=C6H2+H2+H',\n","    'C6H2=C6H+H',\n","    'C2H+C4H2=C6H2+H',\n","    'C2H+C6H2=C8H2+H',\n","    'C2H+C2H2=C4H2+H',\n","    'C4H2=C4H+H',\n","    'CN+C4H2=HC5N+H',\n","    'C2H4+C4H=C6H2+H2+H',\n","    'C6H+C2H2=C8H2+H',\n","    'C6H+C2H6=C6H2+C2H5',\n","    'CN+HC5N=C6N2+H',\n","    'CH4+N2+=N2+CH2++H2',\n","    'CH2++CH4=C2H4++H2',\n","    'CH2++CH4=C2H5++H',\n","    'C2H4++C2H4=C3H5++CH3',\n","    'C3H5++H=C2H3++CH3'  ,\n","    'HCN+C2H3+=HCNH++C2H2',\n","    'CH4+C2H3+=C3H5++H2' ,\n","    'C2H4++C2H4=C3H5++CH3',\n","    'HCN+C2H7+=HCNH++C2H6' ,\n","    'CH5++C2H6=C2H7++CH4' ,\n","    'CH4+HN2+=N2+CH5+',\n","    'CH4++CH4=CH5++CH3',\n","    'CH5++HCN=HCNH++CH4',\n","    'CH5++C2H4=C2H5++CH4',\n","    'HCN+C2H5+=C2H4+HCNH+',\n","    'N++CH4=HCNH++H2',\n","    'N++CH4=HCNH++2H',\n","    'HCNH++E=CN+2H',\n","    'HCNH++E=HCN+H',\n","    'HCNH++C4H2=C4H3++HCN',\n","    'CN+C4H2=HC5N+H',\n","    'C2H2+C4H3+=C6H5+',\n","    'C2H4+C4H3+=C6H5++H2',\n","    'C6H5++E=C6H4+H',\n","    'C6H5++E=C6H2+H2+H',\n","    'C6H5++E=C6H+2H2 ',\n","    'C6H4=C6H2+H2',\n","    'C6H4=C4H2+C2H2',\n","    'H+C6H3=C6H2+H2',\n","    'C6H4=C6H3+H',\n","    'C6H7++E=C6H2+2H2+H',\n","    'C6H7++E=C6H6+H',\n","    'C4H5++C2H4=C6H7++H2',\n","    'HCNH++C6H6=C6H7++HCN',\n","    'C2H2+C2H4+=C4H5++H',\n","    'C2H2+C2H5+=C4H5++H2',\n","    'C2H2+C4H5+=C6H5++H2',\n","    'C4H5++E=CH3C2H+CH',\n","    'C2H+CH3C2H=C4H2+CH3',\n","    'CN+CH3C2H=CH3C2CN+H',\n","    'CH3C2CN+C2H=HC5N+CH3',\n","    'CH3C2CN+CN=C4N2+CH3'\n","]\n","print(len(reactions))\n","i = 0\n","data = []\n","Reactions = []\n","Rates = []\n","file_path = directory + fname\n","print(file_path)\n","infile = open(file_path,'r')\n","myline1 = infile.readline()\n","      # Skip to TSTEP\n","while 'REACTIONS:' not in myline1:\n","  myline1 = infile.readline()\n","while not 'WARNING' in myline1:\n","  myline1 = infile.readline()\n","  myline2 = myline1.split()\n","  myline3 = ''.join(myline2)\n","  for item in reactions:\n","      if item in myline3:\n","            i += 1\n","            data.append(myline3)\n","\n","print(data)\n","for item in data:\n","      split1 = item.split(\")\", maxsplit=1)\n","      split2 = split1[1].split('k')\n","      Reactions.append(split2[0])\n","      Rates.append(split2[1].split(\"=\")[1])\n","        #print(Reactions)\n","        #print(Rates)\n","#print(i)\n","\n","df = pd.DataFrame({\n","    'Reaction': Reactions,\n","    'Rate Constant': Rates\n","})\n","\n","#for item in reactions:\n","#  if not item in data:\n","#    print(item)\n","\n","# Display the table\n","print(\"-------------------------\")\n","print(len(df))\n","print(df)\n","atb+='width=\"8\" height=\"3\" '\n","HTML('<iframe src=\"' + src + '\"' + atb + '></iframe>')"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":1000},"executionInfo":{"elapsed":18,"status":"ok","timestamp":1746147990526,"user":{"displayName":"Jaylen Shawcross","userId":"09969990004531500002"},"user_tz":420},"id":"22WArWO9S5IU","outputId":"c88a68f9-cc16-490b-f031-b2913d29e734"},"outputs":[{"output_type":"stream","name":"stdout","text":["help  56\n"]},{"output_type":"display_data","data":{"text/plain":["<IPython.core.display.Math object>"],"text/latex":"$\\displaystyle \\begin{array}{|l|l|}\n\\hline\n\\textbf{Reaction} & \\textbf{Rate Constant} \\\\ \\hline\nCH4\\rightarrow1CH2+H2 & 0.00E+00 \\\\ \\hline\nCH4\\rightarrowCH2+2H & 0.00E+00 \\\\ \\hline\nCH4\\rightarrowCH3+H & 0.00E+00 \\\\ \\hline\nCH4\\rightarrowCH+H+H2 & 0.00E+00 \\\\ \\hline\nC2H4\\rightarrowC2H2+2H & 0.00E+00 \\\\ \\hline\nC4H2\\rightarrowC4H+H & 0.00E+00 \\\\ \\hline\nC6H2\\rightarrowC6H+H & 0.00E+00 \\\\ \\hline\nC6H4\\rightarrowC6H2+H2 & 0.00E+00 \\\\ \\hline\nC6H4\\rightarrowC4H2+C2H2 & 0.00E+00 \\\\ \\hline\nC6H4\\rightarrowC6H3+H & 0.00E+00 \\\\ \\hline\nHC3N\\rightarrowC3N+H & 0.00E+00 \\\\ \\hline\nCH3CN\\rightarrowCN+CH3 & 0.00E+00 \\\\ \\hline\nC2H3CN\\rightarrowHCN+C2H2 & 0.00E+00 \\\\ \\hline\nC2H3CN\\rightarrowHC3N+H2 & 0.00E+00 \\\\ \\hline\nCH2NH\\rightarrowHCN+H2 & 0.00E+00 \\\\ \\hline\nH+CH2\\rightarrowCH+H2 & 2.66E-10T**0.00EXP(0.0/T)(10.<T<400.), \\\\ \\hline\nH+CH4\\rightarrowCH3+H2 & 1.02E-18T**2.50EXP(-4825.0/T)(10.<T<400.), \\\\ \\hline\nH+C2H3\\rightarrowC2H2+H2 & 1.50E-12T**0.50 \\\\ \\hline\nH+C6H3\\rightarrowC6H2+H2 & 3.00E-12T**0.50 \\\\ \\hline\nH+C6H4\\rightarrowC6H3+H2 & 1.10E-17T**2.53EXP(-4648.0/T) \\\\ \\hline\nN+CH3\\rightarrowH2CN+H & 7.40E-11T**0.26EXP(-8.4/T)(10.<T<400.), \\\\ \\hline\nN+CHCN\\rightarrowHCN+CN & 1.40E-11T**0.17 \\\\ \\hline\nN(2D)+C2H6\\rightarrowNH+C2H5 & 1.90E-11 \\\\ \\hline\nN(2D)+C2H3CN\\rightarrowN2+C3H3 & 4.00E-11 \\\\ \\hline\nN(2D)+CH3CN\\rightarrowN2+C2H3 & 5.00E-11 \\\\ \\hline\nN(2D)+HCN\\rightarrowCH+N2 & 5.00E-11 \\\\ \\hline\nN(2D)+C2H6\\rightarrowCH2NH+CH3 & 1.90E-11 \\\\ \\hline\nNH+C2H2\\rightarrowCHCN+H2 & 2.00E-09T**-1.07 \\\\ \\hline\nNH+C2H4\\rightarrowCH3CN+H2 & 1.15E-09T**-1.09 \\\\ \\hline\nNH+C2H4\\rightarrowNH2+C2H3 & 1.16E-09T**-1.09 \\\\ \\hline\nCH+CH4\\rightarrowC2H4+H & 3.96E-08T**-1.04EXP(-36.0/T)(10.<T<295.), \\\\ \\hline\nCH+C2H4\\rightarrowC2H2+CH3 & 2.23E-10EXP(173.0/T) \\\\ \\hline\n2CH3+M\\rightarrowC2H6+M & 0.00E+00EXP(0.0/T) \\\\ \\hline\nC2H+C2H2\\rightarrowC4H2+H & 1.30E-10 \\\\ \\hline\nC2H+CH3C2H\\rightarrowC4H2+CH3 & 1.60E-10EXP(71.0/T) \\\\ \\hline\nC2H+C4H2\\rightarrowC6H2+H & 1.06E-10T**-0.25 \\\\ \\hline\nC2H+C6H2\\rightarrowC8H2+H & 1.06E-10T**-0.20 \\\\ \\hline\nC2H4+C4H\\rightarrowC6H2+H2+H & 1.96E-10T**-0.40EXP(9.0/T) \\\\ \\hline\nC2H4+C4H\\rightarrowC6H2+H2+H & 1.96E-10T**-0.40EXP(9.0/T) \\\\ \\hline\nC6H+C2H2\\rightarrowC8H2+H & 1.10E-10EXP(28.0/T) \\\\ \\hline\nC6H+C2H6\\rightarrowC6H2+C2H5 & 3.50E-11EXP(3.0/T) \\\\ \\hline\nCN+C2H4\\rightarrowC2H3CN+H & 2.70E-11EXP(172.0/T) \\\\ \\hline\nCN+CH3C2H\\rightarrowCH3C2CN+H & 2.05E-10 \\\\ \\hline\nCN+C2H2\\rightarrowHC3N+H & 2.72E-10T**-0.52EXP(-19.0/T) \\\\ \\hline\nCN+C4H2\\rightarrowHC5N+H & 2.72E-10T**-0.52EXP(-19.0/T) \\\\ \\hline\nCN+C4H2\\rightarrowHC5N+H & 2.72E-10T**-0.52EXP(-19.0/T) \\\\ \\hline\nCN+CH2NH\\rightarrowHCN+H2CN & 6.71E-11EXP(-412.0/T) \\\\ \\hline\nCN+HC5N\\rightarrowC6N2+H & 2.70E-10T**-0.52EXP(19.0/T) \\\\ \\hline\nCN+HC5N\\rightarrowC6N2+H & 2.70E-10T**-0.52EXP(19.0/T) \\\\ \\hline\nCN+C2H2\\rightarrowC2H+HCN & 2.20E-10 \\\\ \\hline\nH2CN+H\\rightarrowHCN+H2 & 6.00E-11 \\\\ \\hline\nC3N+C2H2\\rightarrowHC5N+H & 8.60E-15T**1.80EXP(474.0/T) \\\\ \\hline\nCH3C2CN+CN\\rightarrowC4N2+CH3 & 1.79E-11T**-0.67 \\\\ \\hline\nCH3C2CN+C2H\\rightarrowHC5N+CH3 & 4.00E-11T**-1.00 \\\\ \\hline\nCH2NH+1CH2\\rightarrowH2CN+CH3 & 3.00E-10 \\\\ \\hline\nCH2NH+CH\\rightarrowCH3CN+H & 2.00E-10 \\\\ \\hline\n\\end{array}$"},"metadata":{}}],"source":["import pandas as pd\n","from IPython.display import display, Math\n","import re  # Import regex module\n","\n","# Now we prepare the LaTeX output\n","latex_output = \"\\\\begin{array}{|l|l|}\\n\\\\hline\\n\\\\textbf{Reaction} & \\\\textbf{Rate Constant} \\\\\\\\ \\\\hline\\n\"\n","\n","i = 0\n","for reaction, rate in zip(Reactions, Rates):\n","    # Format the reaction for LaTeX\n","    i += 1\n","    latex_reaction = reaction.replace(\"=\", \"\\\\rightarrow\")  # Correct LaTeX arrow\n","\n","    # Superscript first plus sign when two plus signs are in a row\n","    latex_reaction = re.sub(r\"\\+\\+\", r\"^{+}+\", latex_reaction)\n","\n","    # Superscript plus sign before the arrow\n","    latex_reaction = re.sub(r\"\\+\\\\rightarrow\", r\"^{+}\\\\rightarrow\", latex_reaction)\n","\n","    latex_output += f\"{latex_reaction} & {rate} \\\\\\\\ \\\\hline\\n\"\n","\n","print(\"help \", i)\n","\n","latex_output += \"\\\\end{array}\"\n","\n","# Print the LaTeX code\n","#print(latex_output)\n","\n","# Optionally, display it as a LaTeX table in Jupyter Notebook\n","display(Math(latex_output))\n"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":1000},"executionInfo":{"elapsed":80,"status":"ok","timestamp":1746147990609,"user":{"displayName":"Jaylen Shawcross","userId":"09969990004531500002"},"user_tz":420},"id":"LIfHeH5mYn9b","outputId":"b663bfc4-c170-4aea-faea-f483f53356cb"},"outputs":[{"output_type":"stream","name":"stdout","text":["56\n","\\begin{array}{|l|l|}\n","\\hline\n","\\textbf{Reaction} & \\textbf{Rate Constant} \\\\ \\hline\n","$CH_{4}\\rightarrow 1CH_{2}+H_{2}$ & $0.00E+00$ \\\\ \\hline\n","$CH_{4}\\rightarrow CH_{2}+2H$ & $0.00E+00$ \\\\ \\hline\n","$CH_{4}\\rightarrow CH_{3}+H$ & $0.00E+00$ \\\\ \\hline\n","$CH_{4}\\rightarrow CH+H+H_{2}$ & $0.00E+00$ \\\\ \\hline\n","$C_{2}H_{4}\\rightarrow C_{2}H_{2}+2H$ & $0.00E+00$ \\\\ \\hline\n","$C_{4}H_{2}\\rightarrow C_{4}H+H$ & $0.00E+00$ \\\\ \\hline\n","$C_{6}H_{2}\\rightarrow C_{6}H+H$ & $0.00E+00$ \\\\ \\hline\n","$C_{6}H_{4}\\rightarrow C_{6}H_{2}+H_{2}$ & $0.00E+00$ \\\\ \\hline\n","$C_{6}H_{4}\\rightarrow C_{4}H_{2}+C_{2}H_{2}$ & $0.00E+00$ \\\\ \\hline\n","$C_{6}H_{4}\\rightarrow C_{6}H_{3}+H$ & $0.00E+00$ \\\\ \\hline\n","$HC_{3}N\\rightarrow C_{3}N+H$ & $0.00E+00$ \\\\ \\hline\n","$CH_{3}CN\\rightarrow CN+CH_{3}$ & $0.00E+00$ \\\\ \\hline\n","$C_{2}H_{3}CN\\rightarrow HCN+C_{2}H_{2}$ & $0.00E+00$ \\\\ \\hline\n","$C_{2}H_{3}CN\\rightarrow HC_{3}N+H_{2}$ & $0.00E+00$ \\\\ \\hline\n","$CH_{2}NH\\rightarrow HCN+H_{2}$ & $0.00E+00$ \\\\ \\hline\n","$H+CH_{2}\\rightarrow CH+H_{2}$ & $2.66 \\times 10^{-10}T**0.00EXP(0.0/T)(10.<T<400.),$ \\\\ \\hline\n","$H+CH_{4}\\rightarrow CH_{3}+H_{2}$ & $1.02 \\times 10^{-18}T**2.50EXP(-4825.0/T)(10.<T<400.),$ \\\\ \\hline\n","$H+C_{2}H_{3}\\rightarrow C_{2}H_{2}+H_{2}$ & $1.50 \\times 10^{-12}T**0.50$ \\\\ \\hline\n","$H+C_{6}H_{3}\\rightarrow C_{6}H_{2}+H_{2}$ & $3.00 \\times 10^{-12}T**0.50$ \\\\ \\hline\n","$H+C_{6}H_{4}\\rightarrow C_{6}H_{3}+H_{2}$ & $1.10 \\times 10^{-17}T**2.53EXP(-4648.0/T)$ \\\\ \\hline\n","$N+CH_{3}\\rightarrow H_{2}CN+H$ & $7.40 \\times 10^{-11}T**0.26EXP(-8.4/T)(10.<T<400.),$ \\\\ \\hline\n","$N+CHCN\\rightarrow HCN+CN$ & $1.40 \\times 10^{-11}T**0.17$ \\\\ \\hline\n","$N(2D)+C_{2}H_{6}\\rightarrow NH+C_{2}H_{5}$ & $1.90 \\times 10^{-11}$ \\\\ \\hline\n","$N(2D)+C_{2}H_{3}CN\\rightarrow N_{2}+C_{3}H_{3}$ & $4.00 \\times 10^{-11}$ \\\\ \\hline\n","$N(2D)+CH_{3}CN\\rightarrow N_{2}+C_{2}H_{3}$ & $5.00 \\times 10^{-11}$ \\\\ \\hline\n","$N(2D)+HCN\\rightarrow CH+N_{2}$ & $5.00 \\times 10^{-11}$ \\\\ \\hline\n","$N(2D)+C_{2}H_{6}\\rightarrow CH_{2}NH+CH_{3}$ & $1.90 \\times 10^{-11}$ \\\\ \\hline\n","$NH+C_{2}H_{2}\\rightarrow CHCN+H_{2}$ & $2.00 \\times 10^{-09}T**-1.07$ \\\\ \\hline\n","$NH+C_{2}H_{4}\\rightarrow CH_{3}CN+H_{2}$ & $1.15 \\times 10^{-09}T**-1.09$ \\\\ \\hline\n","$NH+C_{2}H_{4}\\rightarrow NH_{2}+C_{2}H_{3}$ & $1.16 \\times 10^{-09}T**-1.09$ \\\\ \\hline\n","$CH+CH_{4}\\rightarrow C_{2}H_{4}+H$ & $3.96 \\times 10^{-08}T**-1.04EXP(-36.0/T)(10.<T<295.),$ \\\\ \\hline\n","$CH+C_{2}H_{4}\\rightarrow C_{2}H_{2}+CH_{3}$ & $2.23 \\times 10^{-10}EXP(173.0/T)$ \\\\ \\hline\n","$2CH_{3}+M\\rightarrow C_{2}H_{6}+M$ & $0.00 \\times 10^{+00}EXP(0.0/T)$ \\\\ \\hline\n","$C_{2}H+C_{2}H_{2}\\rightarrow C_{4}H_{2}+H$ & $1.30 \\times 10^{-10}$ \\\\ \\hline\n","$C_{2}H+CH_{3}C_{2}H\\rightarrow C_{4}H_{2}+CH_{3}$ & $1.60 \\times 10^{-10}EXP(71.0/T)$ \\\\ \\hline\n","$C_{2}H+C_{4}H_{2}\\rightarrow C_{6}H_{2}+H$ & $1.06 \\times 10^{-10}T**-0.25$ \\\\ \\hline\n","$C_{2}H+C_{6}H_{2}\\rightarrow C_{8}H_{2}+H$ & $1.06 \\times 10^{-10}T**-0.20$ \\\\ \\hline\n","$C_{2}H_{4}+C_{4}H\\rightarrow C_{6}H_{2}+H_{2}+H$ & $1.96 \\times 10^{-10}T**-0.40EXP(9.0/T)$ \\\\ \\hline\n","$C_{2}H_{4}+C_{4}H\\rightarrow C_{6}H_{2}+H_{2}+H$ & $1.96 \\times 10^{-10}T**-0.40EXP(9.0/T)$ \\\\ \\hline\n","$C_{6}H+C_{2}H_{2}\\rightarrow C_{8}H_{2}+H$ & $1.10 \\times 10^{-10}EXP(28.0/T)$ \\\\ \\hline\n","$C_{6}H+C_{2}H_{6}\\rightarrow C_{6}H_{2}+C_{2}H_{5}$ & $3.50 \\times 10^{-11}EXP(3.0/T)$ \\\\ \\hline\n","$CN+C_{2}H_{4}\\rightarrow C_{2}H_{3}CN+H$ & $2.70 \\times 10^{-11}EXP(172.0/T)$ \\\\ \\hline\n","$CN+CH_{3}C_{2}H\\rightarrow CH_{3}C_{2}CN+H$ & $2.05 \\times 10^{-10}$ \\\\ \\hline\n","$CN+C_{2}H_{2}\\rightarrow HC_{3}N+H$ & $2.72 \\times 10^{-10}T**-0.52EXP(-19.0/T)$ \\\\ \\hline\n","$CN+C_{4}H_{2}\\rightarrow HC_{5}N+H$ & $2.72 \\times 10^{-10}T**-0.52EXP(-19.0/T)$ \\\\ \\hline\n","$CN+C_{4}H_{2}\\rightarrow HC_{5}N+H$ & $2.72 \\times 10^{-10}T**-0.52EXP(-19.0/T)$ \\\\ \\hline\n","$CN+CH_{2}NH\\rightarrow HCN+H_{2}CN$ & $6.71 \\times 10^{-11}EXP(-412.0/T)$ \\\\ \\hline\n","$CN+HC_{5}N\\rightarrow C_{6}N_{2}+H$ & $2.70 \\times 10^{-10}T**-0.52EXP(19.0/T)$ \\\\ \\hline\n","$CN+HC_{5}N\\rightarrow C_{6}N_{2}+H$ & $2.70 \\times 10^{-10}T**-0.52EXP(19.0/T)$ \\\\ \\hline\n","$CN+C_{2}H_{2}\\rightarrow C_{2}H+HCN$ & $2.20 \\times 10^{-10}$ \\\\ \\hline\n","$H_{2}CN+H\\rightarrow HCN+H_{2}$ & $6.00 \\times 10^{-11}$ \\\\ \\hline\n","$C_{3}N+C_{2}H_{2}\\rightarrow HC_{5}N+H$ & $8.60 \\times 10^{-15}T**1.80EXP(474.0/T)$ \\\\ \\hline\n","$CH_{3}C_{2}CN+CN\\rightarrow C_{4}N_{2}+CH_{3}$ & $1.79 \\times 10^{-11}T**-0.67$ \\\\ \\hline\n","$CH_{3}C_{2}CN+C_{2}H\\rightarrow HC_{5}N+CH_{3}$ & $4.00 \\times 10^{-11}T**-1.00$ \\\\ \\hline\n","$CH_{2}NH+1CH_{2}\\rightarrow H_{2}CN+CH_{3}$ & $3.00 \\times 10^{-10}$ \\\\ \\hline\n","$CH_{2}NH+CH\\rightarrow CH_{3}CN+H$ & $2.00 \\times 10^{-10}$ \\\\ \\hline\n","\\end{array}\n"]},{"output_type":"display_data","data":{"text/plain":["<IPython.core.display.Math object>"],"text/latex":"$\\displaystyle \\begin{array}{|l|l|}\n\\hline\n\\textbf{Reaction} & \\textbf{Rate Constant} \\\\ \\hline\n$CH_{4}\\rightarrow 1CH_{2}+H_{2}$ & $0.00E+00$ \\\\ \\hline\n$CH_{4}\\rightarrow CH_{2}+2H$ & $0.00E+00$ \\\\ \\hline\n$CH_{4}\\rightarrow CH_{3}+H$ & $0.00E+00$ \\\\ \\hline\n$CH_{4}\\rightarrow CH+H+H_{2}$ & $0.00E+00$ \\\\ \\hline\n$C_{2}H_{4}\\rightarrow C_{2}H_{2}+2H$ & $0.00E+00$ \\\\ \\hline\n$C_{4}H_{2}\\rightarrow C_{4}H+H$ & $0.00E+00$ \\\\ \\hline\n$C_{6}H_{2}\\rightarrow C_{6}H+H$ & $0.00E+00$ \\\\ \\hline\n$C_{6}H_{4}\\rightarrow C_{6}H_{2}+H_{2}$ & $0.00E+00$ \\\\ \\hline\n$C_{6}H_{4}\\rightarrow C_{4}H_{2}+C_{2}H_{2}$ & $0.00E+00$ \\\\ \\hline\n$C_{6}H_{4}\\rightarrow C_{6}H_{3}+H$ & $0.00E+00$ \\\\ \\hline\n$HC_{3}N\\rightarrow C_{3}N+H$ & $0.00E+00$ \\\\ \\hline\n$CH_{3}CN\\rightarrow CN+CH_{3}$ & $0.00E+00$ \\\\ \\hline\n$C_{2}H_{3}CN\\rightarrow HCN+C_{2}H_{2}$ & $0.00E+00$ \\\\ \\hline\n$C_{2}H_{3}CN\\rightarrow HC_{3}N+H_{2}$ & $0.00E+00$ \\\\ \\hline\n$CH_{2}NH\\rightarrow HCN+H_{2}$ & $0.00E+00$ \\\\ \\hline\n$H+CH_{2}\\rightarrow CH+H_{2}$ & $2.66 \\times 10^{-10}T**0.00EXP(0.0/T)(10.<T<400.),$ \\\\ \\hline\n$H+CH_{4}\\rightarrow CH_{3}+H_{2}$ & $1.02 \\times 10^{-18}T**2.50EXP(-4825.0/T)(10.<T<400.),$ \\\\ \\hline\n$H+C_{2}H_{3}\\rightarrow C_{2}H_{2}+H_{2}$ & $1.50 \\times 10^{-12}T**0.50$ \\\\ \\hline\n$H+C_{6}H_{3}\\rightarrow C_{6}H_{2}+H_{2}$ & $3.00 \\times 10^{-12}T**0.50$ \\\\ \\hline\n$H+C_{6}H_{4}\\rightarrow C_{6}H_{3}+H_{2}$ & $1.10 \\times 10^{-17}T**2.53EXP(-4648.0/T)$ \\\\ \\hline\n$N+CH_{3}\\rightarrow H_{2}CN+H$ & $7.40 \\times 10^{-11}T**0.26EXP(-8.4/T)(10.<T<400.),$ \\\\ \\hline\n$N+CHCN\\rightarrow HCN+CN$ & $1.40 \\times 10^{-11}T**0.17$ \\\\ \\hline\n$N(2D)+C_{2}H_{6}\\rightarrow NH+C_{2}H_{5}$ & $1.90 \\times 10^{-11}$ \\\\ \\hline\n$N(2D)+C_{2}H_{3}CN\\rightarrow N_{2}+C_{3}H_{3}$ & $4.00 \\times 10^{-11}$ \\\\ \\hline\n$N(2D)+CH_{3}CN\\rightarrow N_{2}+C_{2}H_{3}$ & $5.00 \\times 10^{-11}$ \\\\ \\hline\n$N(2D)+HCN\\rightarrow CH+N_{2}$ & $5.00 \\times 10^{-11}$ \\\\ \\hline\n$N(2D)+C_{2}H_{6}\\rightarrow CH_{2}NH+CH_{3}$ & $1.90 \\times 10^{-11}$ \\\\ \\hline\n$NH+C_{2}H_{2}\\rightarrow CHCN+H_{2}$ & $2.00 \\times 10^{-09}T**-1.07$ \\\\ \\hline\n$NH+C_{2}H_{4}\\rightarrow CH_{3}CN+H_{2}$ & $1.15 \\times 10^{-09}T**-1.09$ \\\\ \\hline\n$NH+C_{2}H_{4}\\rightarrow NH_{2}+C_{2}H_{3}$ & $1.16 \\times 10^{-09}T**-1.09$ \\\\ \\hline\n$CH+CH_{4}\\rightarrow C_{2}H_{4}+H$ & $3.96 \\times 10^{-08}T**-1.04EXP(-36.0/T)(10.<T<295.),$ \\\\ \\hline\n$CH+C_{2}H_{4}\\rightarrow C_{2}H_{2}+CH_{3}$ & $2.23 \\times 10^{-10}EXP(173.0/T)$ \\\\ \\hline\n$2CH_{3}+M\\rightarrow C_{2}H_{6}+M$ & $0.00 \\times 10^{+00}EXP(0.0/T)$ \\\\ \\hline\n$C_{2}H+C_{2}H_{2}\\rightarrow C_{4}H_{2}+H$ & $1.30 \\times 10^{-10}$ \\\\ \\hline\n$C_{2}H+CH_{3}C_{2}H\\rightarrow C_{4}H_{2}+CH_{3}$ & $1.60 \\times 10^{-10}EXP(71.0/T)$ \\\\ \\hline\n$C_{2}H+C_{4}H_{2}\\rightarrow C_{6}H_{2}+H$ & $1.06 \\times 10^{-10}T**-0.25$ \\\\ \\hline\n$C_{2}H+C_{6}H_{2}\\rightarrow C_{8}H_{2}+H$ & $1.06 \\times 10^{-10}T**-0.20$ \\\\ \\hline\n$C_{2}H_{4}+C_{4}H\\rightarrow C_{6}H_{2}+H_{2}+H$ & $1.96 \\times 10^{-10}T**-0.40EXP(9.0/T)$ \\\\ \\hline\n$C_{2}H_{4}+C_{4}H\\rightarrow C_{6}H_{2}+H_{2}+H$ & $1.96 \\times 10^{-10}T**-0.40EXP(9.0/T)$ \\\\ \\hline\n$C_{6}H+C_{2}H_{2}\\rightarrow C_{8}H_{2}+H$ & $1.10 \\times 10^{-10}EXP(28.0/T)$ \\\\ \\hline\n$C_{6}H+C_{2}H_{6}\\rightarrow C_{6}H_{2}+C_{2}H_{5}$ & $3.50 \\times 10^{-11}EXP(3.0/T)$ \\\\ \\hline\n$CN+C_{2}H_{4}\\rightarrow C_{2}H_{3}CN+H$ & $2.70 \\times 10^{-11}EXP(172.0/T)$ \\\\ \\hline\n$CN+CH_{3}C_{2}H\\rightarrow CH_{3}C_{2}CN+H$ & $2.05 \\times 10^{-10}$ \\\\ \\hline\n$CN+C_{2}H_{2}\\rightarrow HC_{3}N+H$ & $2.72 \\times 10^{-10}T**-0.52EXP(-19.0/T)$ \\\\ \\hline\n$CN+C_{4}H_{2}\\rightarrow HC_{5}N+H$ & $2.72 \\times 10^{-10}T**-0.52EXP(-19.0/T)$ \\\\ \\hline\n$CN+C_{4}H_{2}\\rightarrow HC_{5}N+H$ & $2.72 \\times 10^{-10}T**-0.52EXP(-19.0/T)$ \\\\ \\hline\n$CN+CH_{2}NH\\rightarrow HCN+H_{2}CN$ & $6.71 \\times 10^{-11}EXP(-412.0/T)$ \\\\ \\hline\n$CN+HC_{5}N\\rightarrow C_{6}N_{2}+H$ & $2.70 \\times 10^{-10}T**-0.52EXP(19.0/T)$ \\\\ \\hline\n$CN+HC_{5}N\\rightarrow C_{6}N_{2}+H$ & $2.70 \\times 10^{-10}T**-0.52EXP(19.0/T)$ \\\\ \\hline\n$CN+C_{2}H_{2}\\rightarrow C_{2}H+HCN$ & $2.20 \\times 10^{-10}$ \\\\ \\hline\n$H_{2}CN+H\\rightarrow HCN+H_{2}$ & $6.00 \\times 10^{-11}$ \\\\ \\hline\n$C_{3}N+C_{2}H_{2}\\rightarrow HC_{5}N+H$ & $8.60 \\times 10^{-15}T**1.80EXP(474.0/T)$ \\\\ \\hline\n$CH_{3}C_{2}CN+CN\\rightarrow C_{4}N_{2}+CH_{3}$ & $1.79 \\times 10^{-11}T**-0.67$ \\\\ \\hline\n$CH_{3}C_{2}CN+C_{2}H\\rightarrow HC_{5}N+CH_{3}$ & $4.00 \\times 10^{-11}T**-1.00$ \\\\ \\hline\n$CH_{2}NH+1CH_{2}\\rightarrow H_{2}CN+CH_{3}$ & $3.00 \\times 10^{-10}$ \\\\ \\hline\n$CH_{2}NH+CH\\rightarrow CH_{3}CN+H$ & $2.00 \\times 10^{-10}$ \\\\ \\hline\n\\end{array}$"},"metadata":{}}],"source":["import pandas as pd\n","import re\n","from IPython.display import display, Math\n","\n","# Function to convert numbers immediately after letters into LaTeX subscript format\n","def add_subscripts_and_superscripts(chemical_formula):\n","    # Convert numbers after letters into LaTeX subscript format\n","    chemical_formula = re.sub(r'([A-Za-z])(\\d+)', r'\\1_{\\2}', chemical_formula)\n","\n","    # Convert numbers inside parentheses into LaTeX superscript format\n","    chemical_formula = re.sub(r'\\((\\d+)\\)', r'^{\\1}', chemical_formula)\n","\n","    return chemical_formula\n","\n","# Function to convert scientific notation (E notation) into LaTeX format\n","def convert_scientific_notation(rate):\n","    # Find occurrences of scientific notation (e.g., 1.23E+10)\n","    rate = re.sub(r'([0-9\\.]+)[Ee]([+-]?\\d+)', r'\\1 \\\\times 10^{\\2}', rate)\n","    return rate\n","\n","# Now prepare the LaTeX output\n","latex_output = \"\\\\begin{array}{|l|l|}\\n\\\\hline\\n\\\\textbf{Reaction} & \\\\textbf{Rate Constant} \\\\\\\\ \\\\hline\\n\"\n","i = 0\n","for reaction, rate in zip(Reactions, Rates):\n","    # Convert reactions to LaTeX format\n","    i += 1\n","    latex_reaction = reaction.replace(\"=\", r\"\\rightarrow \")  # Replace '=' with LaTeX arrow\n","    latex_reaction = add_subscripts_and_superscripts(latex_reaction)  # Add subscripts and superscripts where applicable\n","\n","    # Superscript first plus sign when two plus signs are in a row\n","    latex_reaction = re.sub(r\"\\+\\+\", r\"^{+}+\", latex_reaction)\n","\n","    # Superscript plus sign before the arrow\n","    latex_reaction = re.sub(r\"\\+\\\\rightarrow\", r\"^{+}\\\\rightarrow\", latex_reaction)\n","\n","    # If rate is not \"0.00E+00\", convert to LaTeX scientific notation\n","    if rate != \"0.00E+00\":\n","        latex_rate = convert_scientific_notation(str(rate))\n","    else:\n","        latex_rate = str(rate)  # Keep '0' as is\n","\n","    # Ensure that each row has exactly two columns\n","    latex_output += f\"${latex_reaction}$ & ${latex_rate}$ \\\\\\\\ \\\\hline\\n\"\n","\n","print(i)\n","latex_output += \"\\\\end{array}\"\n","\n","# Print the LaTeX code (if needed)\n","print(latex_output)\n","\n","# Optionally, display it as a LaTeX table in Jupyter Notebook\n","display(Math(latex_output))\n"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"gSdu4Lae96Ji","executionInfo":{"status":"ok","timestamp":1746147993975,"user_tz":420,"elapsed":3362,"user":{"displayName":"Jaylen Shawcross","userId":"09969990004531500002"}},"outputId":"d6b6c474-277a-4e1f-a359-9d49f935524e"},"outputs":[{"output_type":"stream","name":"stdout","text":["/content/drive/My Drive/gasNeitherEdMin.out-1\n"," DIMENSIONS:\n","\n","/content/drive/My Drive/gasCationsMin.out-1\n"," DIMENSIONS:\n","\n","/content/drive/My Drive/gasNeither4.out-1\n"," DIMENSIONS:\n","\n","/content/drive/My Drive/gasCations2.out-1\n"," DIMENSIONS:\n","\n","\n","LaTeX formatted table:\n","\\begin{tabular}{ll}\n","\\toprule\n","Reaction & Rate Constant \\\\\n","\\midrule\n","CH4=1CH2+H2 & 0.00E+00 \\\\\n","CH4=CH2+2H & 0.00E+00 \\\\\n","CH4=CH3+H & 0.00E+00 \\\\\n","CH4=CH+H+H2 & 0.00E+00 \\\\\n","C2H4=C2H2+2H & 0.00E+00 \\\\\n","C4H2=C4H+H & 0.00E+00 \\\\\n","C6H2=C6H+H & 0.00E+00 \\\\\n","C6H4=C6H2+H2 & 0.00E+00 \\\\\n","C6H4=C4H2+C2H2 & 0.00E+00 \\\\\n","C6H4=C6H3+H & 0.00E+00 \\\\\n","HC3N=C3N+H & 0.00E+00 \\\\\n","CH3CN=CN+CH3 & 0.00E+00 \\\\\n","C2H3CN=HCN+C2H2 & 0.00E+00 \\\\\n","C2H3CN=HC3N+H2 & 0.00E+00 \\\\\n","CH2NH=HCN+H2 & 0.00E+00 \\\\\n","H+CH2=CH+H2 & 2.66E-10T**0.00EXP(0.0/T)(10.<T<400.), \\\\\n","H+CH4=CH3+H2 & 1.02E-18T**2.50EXP(-4825.0/T)(10.<T<400.), \\\\\n","H+C2H3=C2H2+H2 & 1.50E-12T**0.50 \\\\\n","H+C6H3=C6H2+H2 & 3.00E-12T**0.50 \\\\\n","H+C6H4=C6H3+H2 & 1.10E-17T**2.53EXP(-4648.0/T) \\\\\n","N+CH3=H2CN+H & 7.40E-11T**0.26EXP(-8.4/T)(10.<T<400.), \\\\\n","N+CHCN=HCN+CN & 1.40E-11T**0.17 \\\\\n","N(2D)+C2H6=NH+C2H5 & 1.90E-11 \\\\\n","N(2D)+C2H3CN=N2+C3H3 & 4.00E-11 \\\\\n","N(2D)+CH3CN=N2+C2H3 & 5.00E-11 \\\\\n","N(2D)+HCN=CH+N2 & 5.00E-11 \\\\\n","N(2D)+C2H6=CH2NH+CH3 & 1.90E-11 \\\\\n","NH+C2H2=CHCN+H2 & 2.00E-09T**-1.07 \\\\\n","NH+C2H4=CH3CN+H2 & 1.15E-09T**-1.09 \\\\\n","NH+C2H4=NH2+C2H3 & 1.16E-09T**-1.09 \\\\\n","CH+CH4=C2H4+H & 3.96E-08T**-1.04EXP(-36.0/T)(10.<T<295.), \\\\\n","CH+C2H4=C2H2+CH3 & 2.23E-10EXP(173.0/T) \\\\\n","2CH3+M=C2H6+M & 0.00E+00EXP(0.0/T) \\\\\n","C2H+C2H2=C4H2+H & 1.30E-10 \\\\\n","C2H+CH3C2H=C4H2+CH3 & 1.60E-10EXP(71.0/T) \\\\\n","C2H+C4H2=C6H2+H & 1.06E-10T**-0.25 \\\\\n","C2H+C6H2=C8H2+H & 1.06E-10T**-0.20 \\\\\n","C2H4+C4H=C6H2+H2+H & 1.96E-10T**-0.40EXP(9.0/T) \\\\\n","C2H4+C4H=C6H2+H2+H & 1.96E-10T**-0.40EXP(9.0/T) \\\\\n","C6H+C2H2=C8H2+H & 1.10E-10EXP(28.0/T) \\\\\n","C6H+C2H6=C6H2+C2H5 & 3.50E-11EXP(3.0/T) \\\\\n","CN+C2H4=C2H3CN+H & 2.70E-11EXP(172.0/T) \\\\\n","CN+CH3C2H=CH3C2CN+H & 2.05E-10 \\\\\n","CN+C2H2=HC3N+H & 2.72E-10T**-0.52EXP(-19.0/T) \\\\\n","CN+C4H2=HC5N+H & 2.72E-10T**-0.52EXP(-19.0/T) \\\\\n","CN+C4H2=HC5N+H & 2.72E-10T**-0.52EXP(-19.0/T) \\\\\n","CN+CH2NH=HCN+H2CN & 6.71E-11EXP(-412.0/T) \\\\\n","CN+HC5N=C6N2+H & 2.70E-10T**-0.52EXP(19.0/T) \\\\\n","CN+HC5N=C6N2+H & 2.70E-10T**-0.52EXP(19.0/T) \\\\\n","CN+C2H2=C2H+HCN & 2.20E-10 \\\\\n","H2CN+H=HCN+H2 & 6.00E-11 \\\\\n","C3N+C2H2=HC5N+H & 8.60E-15T**1.80EXP(474.0/T) \\\\\n","CH3C2CN+CN=C4N2+CH3 & 1.79E-11T**-0.67 \\\\\n","CH3C2CN+C2H=HC5N+CH3 & 4.00E-11T**-1.00 \\\\\n","CH2NH+1CH2=H2CN+CH3 & 3.00E-10 \\\\\n","CH2NH+CH=CH3CN+H & 2.00E-10 \\\\\n","\\bottomrule\n","\\end{tabular}\n","\n"]}],"source":["# For photolysis Reactions:\n","data = []\n","photolysis_rates1 = []\n","photolysis_rates2 = []\n","photolysis_rates3 = []\n","photolysis_rates4 = []\n","photolysis_reactions = []\n","\n","directory = '/content/drive/My Drive/'\n","\n","def extract_reaction_and_value(row):\n","    # The chemical reaction is everything up to the last 4 elements\n","    reaction = \"\".join(row[1:-4])\n","    # The final value is the last element\n","    last_value = row[-1]\n","    if j == 1:\n","      photolysis_reactions.append(\"\".join(reaction))\n","      photolysis_rates1.append(last_value)\n","      return \"\".join(reaction), last_value\n","    if j == 2:\n","      photolysis_rates2.append(last_value)\n","      return \"\".join(reaction), last_value\n","    if j == 3:\n","      photolysis_rates3.append(last_value)\n","      return \"\".join(reaction), last_value\n","    if j == 4:\n","      photolysis_rates4.append(last_value)\n","      return \"\".join(reaction), last_value\n","\n","\n","j = 1\n","#print(len(reactions))\n","#fnames = ['gasNeitherEdMax.out-1','gasCationsMax2.out-1','gasNeitherEdFlare.out-1','gasCationsEdFlare.out-1']\n","fnames = ['gasNeitherEdMin.out-1', 'gasCationsMin.out-1', 'gasNeither4.out-1', 'gasCations2.out-1']\n","\n","'''for i in range(len(fnames)):\n","  file_path = directory + fnames[i]\n","  #print(file_path)\n","  infile = open(file_path,'r')\n","  for i in range(0, 10):\n","    myline1 = infile.readline()\n","    print(myline1)\n","'''\n","\n","for i in range(len(fnames)):\n","  file_path = directory + fnames[i]\n","  print(file_path)\n","  #print(file_path)\n","  with open(file_path, 'r', encoding='utf-8', errors='ignore') as infile:\n","    myline1 = infile.readline()\n","    print(myline1)\n","    '''while 'RATE CONSTANT' not in myline1:\n","      myline1 = infile.readline()\n","    while 'RATE CONSTANT' not in myline1:\n","      myline1 = infile.readline()\n","    while 'RATE CONSTANT' not in myline1:\n","      myline1 = infile.readline()'''\n","    myline1 = infile.readline()\n","    #print(myline1)\n","    while \"PHOTOCHEMICAL RATE CONSTANTS:\" not in myline1:\n","      myline1 = infile.readline()\n","    myline1 = infile.readline()\n","    #print(myline1)\n","    while \"PHOTOCHEMICAL RATE CONSTANTS:\" not in myline1:\n","      myline1 = infile.readline()\n","\n","    myline1 = infile.readline()\n","    #print(myline1)\n","    while not 'REACTION RATES:' in myline1:\n","      #print(\"Here\")\n","      myline1 = infile.readline()\n","      #print(myline1)\n","      myline2 = myline1.split()\n","      myline3 = ''.join(myline2)\n","      for item in reactions:\n","        #print(myline3)\n","        if item in myline3:\n","            #data.append(myline3)\n","            split_line = myline2\n","            #print(split_line)\n","            reaction, last_value = extract_reaction_and_value(split_line)\n","            #print(f\"Reaction: {reaction}, Final Value: {last_value}\")\n","            #print(reaction, last_value)\n","    j += 1\n","#print(photolysis_reactions)\n","\n","#Titles = [\"Neutrals Only, Solar Maximum\", \"Neutrals and Cations, Solar Maximum\", \"Neutrals Only, Solar Flare\", \"Neutrals and Cations, Solar Flare\"]\n","Titles = [\"Neutrals Only, Solar Minmum\", \"Neutrals and Cations, Solar Minimum\", \"Neutrals Only, Solar Baseline\", \"Neutrals and Cations, Solar Baseline\"]\n","\n","# Convert the DataFrame to LaTeX format\n","latex_table = df.to_latex(index=False)\n","\n","# Print the LaTeX formatted table\n","print(\"\\nLaTeX formatted table:\")\n","print(latex_table)"]},{"cell_type":"code","source":["# Combine all the rates into one table\n","table_data = []\n","\n","for i in range(len(photolysis_reactions)):\n","    row = {\n","        \"Reaction\": photolysis_reactions[i],\n","        Titles[0]: photolysis_rates1[i],\n","        Titles[1]: photolysis_rates2[i],\n","        Titles[2]: photolysis_rates3[i],\n","        Titles[3]: photolysis_rates4[i],\n","    }\n","    table_data.append(row)\n","\n","# Create a pandas DataFrame\n","df = pd.DataFrame(table_data)\n","\n","# Convert the DataFrame to LaTeX format\n","latex_table = df.to_latex(index=False)\n","\n","# Print the LaTeX formatted table\n","print(\"\\nLaTeX formatted table:\")\n","print(latex_table)\n"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"vsotkAMwi5qZ","executionInfo":{"status":"ok","timestamp":1746148238681,"user_tz":420,"elapsed":39,"user":{"displayName":"Jaylen Shawcross","userId":"09969990004531500002"}},"outputId":"1d05a27b-c4f2-4b0b-da90-fb4ff88e62d6"},"execution_count":null,"outputs":[{"output_type":"stream","name":"stdout","text":["\n","LaTeX formatted table:\n","\\begin{tabular}{lllll}\n","\\toprule\n","Reaction & Neutrals Only, Solar Minmum & Neutrals and Cations, Solar Minimum & Neutrals Only, Solar Baseline & Neutrals and Cations, Solar Baseline \\\\\n","\\midrule\n","CH4=1CH2+H2 & 2.936E-09 & 2.938E-09 & 1.703E-09 & 1.701E-09 \\\\\n","CH4=CH2+2H & 4.088E-10 & 4.091E-10 & 1.562E-10 & 1.558E-10 \\\\\n","CH4=CH3+H & 2.152E-09 & 2.152E-09 & 1.105E-09 & 1.104E-09 \\\\\n","CH4=CH+H+H2 & 9.130E-10 & 9.134E-10 & 4.162E-10 & 4.156E-10 \\\\\n","C2H4=C2H2+2H & 1.243E-08 & 1.244E-08 & 9.759E-09 & 9.755E-09 \\\\\n","C4H2=C4H+H & 1.390E-08 & 1.390E-08 & 1.300E-08 & 1.300E-08 \\\\\n","C6H2=C6H+H & 1.390E-08 & 1.390E-08 & 1.300E-08 & 1.300E-08 \\\\\n","C6H4=C6H2+H2 & 4.634E-11 & 4.634E-11 & 4.335E-11 & 4.334E-11 \\\\\n","C6H4=C4H2+C2H2 & 4.634E-11 & 4.634E-11 & 4.335E-11 & 4.334E-11 \\\\\n","C6H4=C6H3+H & 4.634E-11 & 4.634E-11 & 4.335E-11 & 4.334E-11 \\\\\n","HC3N=C3N+H & 3.560E-08 & 3.561E-08 & 3.118E-08 & 3.117E-08 \\\\\n","CH3CN=CN+CH3 & 7.601E-09 & 7.604E-09 & 4.304E-09 & 4.298E-09 \\\\\n","C2H3CN=HCN+C2H2 & 1.020E-07 & 1.020E-07 & 9.489E-08 & 9.488E-08 \\\\\n","C2H3CN=HC3N+H2 & 3.400E-08 & 3.400E-08 & 3.163E-08 & 3.163E-08 \\\\\n","CH2NH=HCN+H2 & 2.081E-08 & 2.082E-08 & 1.708E-08 & 1.707E-08 \\\\\n","\\bottomrule\n","\\end{tabular}\n","\n"]}]}],"metadata":{"colab":{"provenance":[]},"kernelspec":{"display_name":"Python 3","name":"python3"},"language_info":{"name":"python"}},"nbformat":4,"nbformat_minor":0}